package com.yrot.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yrot.admin.entity.SysQuestionBank;
import com.yrot.admin.entity.SysQuestions;
import com.yrot.admin.mapper.SysQuestionBankMapper;
import com.yrot.admin.mapper.SysQuestionsMapper;
import com.yrot.admin.service.ISysQuestionBankService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hemin
 * @since 2019-04-02
 */
@Service
public class SysQuestionBankServiceImpl extends ServiceImpl<SysQuestionBankMapper, SysQuestionBank> implements ISysQuestionBankService {

    @Autowired
    SysQuestionsMapper mapper;

    @Override
    @Transactional
    public void removeBank(Integer bankId) {
        removeById(bankId);
        QueryWrapper<SysQuestions> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("bank_id",bankId);
        mapper.delete(queryWrapper);
    }
}
